﻿
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
using System.ComponentModel.DataAnnotations.Schema;

namespace WinnerCMS.Data.Mapping
{
    public partial class PriceChangesMap
        : System.Data.Entity.ModelConfiguration.EntityTypeConfiguration<WinnerCMS.Model.PriceChange>
    {
        public PriceChangesMap()
        {
            // table
            //ToTable("CMS_PriceChanges");

            // keys
            HasKey(t => t.Id);

            // Properties
            Property(t => t.Id)
                
                .HasDatabaseGeneratedOption(DatabaseGeneratedOption.Identity)
                .IsRequired();
            Property(t => t.OrderId)
                
                .IsRequired();
            Property(t => t.OldPrice)
                
                .HasPrecision(19, 4)
                .IsRequired();
            Property(t => t.NewPrice)
                
                .HasPrecision(19, 4)
                .IsRequired();
            Property(t => t.Admin)
                
                .IsRequired();
            Property(t => t.IP)
                .IsUnicode(false)
                .HasMaxLength(50)
                .IsRequired();
            Property(t => t.CheckInDate)
                
                .IsRequired();

            // Relationships
            HasRequired(t => t.Order)
               .WithMany(t => t.PriceChanges)
               .HasForeignKey(d => d.OrderId);

            //InitializeMapping();
        }
    }
}

